package com.example.kaoshi;

import java.util.*;

/**
 * Created by Quincy on 2018/9/20.
 */
public class YiShu {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String str = null;
        String[] nums = null;
        String[] num = null;
        ArrayList<Integer> list = new ArrayList();
        List<Integer> repeatList = new ArrayList<Integer>();
        StringBuffer sbf = new StringBuffer();
        do {
            str = scanner.nextLine();
            sbf.append(str + "_");
        }while (!str.equals("END"));
        nums = sbf.toString().split("_");
        for (int i = 0; i < nums.length; i++){
            num = nums[i].split("#");
            list.add(Integer.parseInt(num[0],Integer.parseInt(num[1])));
        }
        Stack<Integer> stack = new Stack<>();
        HashSet<Integer> set = new HashSet<>();
        for (Integer it : list){
            stack.push(it);
            set.add(it);
        }

    }


}
